package com.bifrost.service;

import com.bifrost.entity.MerchantStore;
import com.bifrost.entity.Product;
import com.bifrost.entity.ProductSku;
import com.bifrost.entity.User;
import com.bifrost.model.ProductAddModel;
import com.bifrost.model.SkuExcelModel;
import com.bifrost.model.ro.KeywordBatchRO;
import com.bifrost.model.ro.KeywordRO;
import com.bifrost.model.ro.ProductImgUploadRO;
import com.bifrost.model.vo.PageVO;
import org.springframework.data.domain.Page;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author rangf
 * @date 2018/3/5
 */
public interface ProductService {

    /**
     * 返回商品所有所有属性值
     *
     * @param product
     * @return
     */
    List getAllProductOptionValues(Product product);

    /**
     * 查询指定的商品
     * @param id
     * @return
     */
    Product findProduct(Long id);

    /**
     * 获取门店指定类别下的商品（默认sku）列表
     *
     * @param store    门店
     * @param pageSize 类目Id
     * @param minPrice 最低价
     * @param maxPrice 最高价
     * @return List
     */
    PageVO findAllPage(MerchantStore store,String storeIds , String externalIds , String categoryName, String brandName , Integer curPage, Integer pageSize, String sortOrder, String minPrice, String maxPrice, String key, String productBrand, String available , Boolean isDefault);


    Page getProductsByStore(MerchantStore store, String storeIds , String externalIds, String categoryName, String brandName, Integer page, Integer pageSize, String sortType, String minPrice, String maxPrice, String querykey, String brandIds, String available , Boolean isDefault,Boolean skuAvailable,Boolean skuSaleFlag);

    /**
     *  保存商品数据
     *
     * @param productAddModel 商品数据:{ sku数组+ product基本信息 + 门店}
     */
    void newProduct(User user ,ProductAddModel productAddModel , MerchantStore store) ;

    /**
     *
     *  修改商品数据
     *
     * @param productAddModel 商品数据:{ sku数组+ product基本信息}
     */
    void mergeProduct(User user ,ProductAddModel productAddModel);

    /**
     * 查询展示商品数据
     *
     * @param productId 返回商品数据:{ sku数组+ product基本信息 + 门店}
     */
    ProductAddModel findProductModelById(Long productId);

    /**
     *
     * @param imgUploadVOs 图片上传对象
     * @return
     */
    void upload(User user , List<ProductImgUploadRO> imgUploadVOs) throws IOException;

    /**
     * 获取当前门店所有未上架的商品
     * @param merchantId
     * @param externalIds
     * @param productName
     * @param enableUpload
     * @param auditStatus
     * @param startTime
     * @param endTime
     * @param page
     * @param pageSize
     * @return
     */
    PageVO getInitCommodityProduct(Long merchantId,String storeIds, String externalIds, String productName, String enableUpload, String auditStatus,String startTime,String endTime,Integer page,Integer pageSize);

    /**
     * 获取所有商品的审核状态
     *
     * @param merchantId
     * @param externalIds
     * @param productName
     * @param auditStatus
     * @param startTime
     * @param endTime
     * @param page
     * @param pageSize
     * @return
     */
    PageVO getAuditCommodityProduct(Long merchantId,String storeIds, String externalIds, String productName, String auditStatus, String startTime,String endTime, Integer page, Integer pageSize);

    /**
     * 审核商品
     *
     * @param ids
     * @param auditStatus
     * @return
     */
    String auditCommodityProduct(String ids, String auditStatus);

    /**
     * 保存并提交
     * @param imgUploadVOs
     * @return
     */
    void keepAndSubmit(Long userId , List<ProductImgUploadRO> imgUploadVOs) throws IOException;

    /**
     * 商品上下热门
     * @param productIds
     * @param featuredProduct
     */
    void upOrDownHot(String productIds,Boolean featuredProduct);

    ProductAddModel sapGoodsDetail(MerchantStore store , String externalId);

    void batchKeyWordImport(User user, Long storeId,KeywordBatchRO keywordBatchRO);

    PageVO findSkuByKeyWord(String externalIds, Long storeId,String storeIds ,String queryKey, Integer page, Integer pageSize);

    void savePriceHistory(User user , ProductSku sku , BigDecimal skuPrice , BigDecimal retailPrice);

    PageVO skuDetailList(MerchantStore merchantStore, String storeIds, String externalIds, String categoryName, String brandName, Integer page, Integer pageSize, String sortOrder, String minPrice, String maxPrice, String skuName, String brandId, String available);

    List<SkuExcelModel> skuDetail(MerchantStore merchantStore, String storeIds, String externalIds, String categoryName, String brandName, String minPrice, String maxPrice, String skuName, String brandId, String available);
}
